import React from 'react';
import { connect } from 'dva';
import styles from './../IndexPage.less';
import { getData } from '../../../utils/localData'
import { MY_HOST } from '../../../settings'

@connect(({global,shoppingCart }) => ({
  global,shoppingCart
}))
export default class HomeBottom extends React.Component {

  render() {
    const {cartCount} = this.props.shoppingCart
    return (
      <div className={styles.home_bottom}>

        <div className={styles.home_bottom1}>
          <a href="#/" className={styles.home_bottoma}>

          <img src={this.props.type===1||this.props.type===3?"./img/home.png":"./img/home2.png"} className={styles.home_bottomimg} alt=""/>
           <div className= {this.props.type===1||this.props.type===3?styles.home_txt:styles.home_txt2}>首页</div>
          </a>
        </div>

        <div className={styles.home_bottom2}>
          <a href={this.props.type===3?"#/":"#/Laundry_home"}>
          <span className={styles.home_spe}>
            <img src="./img/bot.png" className={styles.home_bottomimg2} alt=""/>
            {(cartCount && cartCount>0)?<span className={styles.home_spein}>{cartCount}</span>:null}
          </span>
          <div className={styles.home_txt3}>洗衣篓</div>
          </a>
        </div>

        <div className={styles.home_bottom3}>
           {/*onClick={() => {this.props.history.push('/Mine_home')}}*/}
          <a href={this.props.type===3?"#/":"#/Mine_home"} className={styles.home_bottoma}>
           <img src={this.props.type===1||this.props.type===3?"./img/mine.png":"./img/mine2.png"} className={styles.home_bottomimg} alt=""/>
           <div className= {this.props.type===1||this.props.type===3?styles.home_txt2:styles.home_txt}>我的</div>
          </a>
        </div>

     </div>
    )
  }

  componentDidMount(){
      const { dispatch } = this.props
      let businessId = this.props.businessId
      let userId = this.props.userId
      if(businessId && userId){
        dispatch({
          type: 'shoppingCart/selShoppingCartCount',
          payload: {businessId:businessId,userId:userId},
        })
      }
  }
}

